//
//  PhoneContentGenerator.swift
//  E-CycleForShop
//
//  Created by enghou on 17/3/13.
//  Copyright © 2017年 xyxorigation. All rights reserved.
//

import Foundation
//临时将size internal_storage对换
class PhoneContentGenerator: NSObject {
    class func array(model : PhoneInfoModel)->Array<Dictionary<String,String>>{
        let touch = (model.touch == 0) ? "不支持" : "支持"
        let finger = (model.fingerprint == 1) ? "不支持" : "支持"
        let light = (model.l_sensor == 0) ? "不支持" : "支持"
        let distance = (model.range_sensor == 0) ? "不支持" : "支持"
        let touchs = (model.screen_touch == 0) ? "触摸良好" : "触摸不正常"
        let itnal_storage = model.internal_storage + "GB"
        let size = model.size + "GB"
        let dict = ["0":"屏幕显示正常","1":"有坏点/亮点/色差","2":"严重老化/漏液/错乱","3":"内屏进水","12":"有坏点/亮点/色差\n严重老化/漏液/错乱","13":"有坏点/亮点/色差\n内屏进水","23":"严重老化/漏液/错乱,内屏进水","123":"有坏点/亮点/色差\n严重老化/漏液/错乱\n内屏进水"]
        
        let display = String(model.screen_show)
        let displayTxt = dict[display]
        var array = [["title":"型号","content":model.phone_model],["title" : "容量","content":itnal_storage],["title":"操作系统","content" : model.system_os],["title":"CPU","content":model.cpu],["title":"内存","content":size],["title":"屏幕分辨率","content": model.resolution_ratio],["title":"多点触控","content" : touch],["title" : "指纹识别传感器" ,"content":finger],["title":"光线传感器","content":light],["title":"距离传感器","content" : distance],["title":"屏幕触摸","content":touchs]]
        
        if displayTxt != nil {
            let element = ["title":"屏幕外观","content":(displayTxt != nil ? displayTxt! : "")]
            array.append(element)
        }
        
        return array
    }
    class func flagArr(model : PhoneInfoModel)->Array<Dictionary<String,Any>>{
        var finger = -1
        if model.fingerprint == 1 {
            finger = 1
        }else {
            finger = 0
        }
        let arr = [["status" : model.rear_camera,"content" : "后置摄像头"],["status" : model.front_camera,"content":"前置摄像头"],["status" : model.flashlight,"content" : "闪光灯"],["status" : model.phone_function,"content" : "通话功能"],["status" : model.compass,"content" : "指南针"],["status" : model.gyroscope,"content":"陀螺仪"],["status":model.loudspeaker,"content" : "扬声器"],["status":model.telephone_receiver,"content" : "听筒"],["status" : model.microphone,"content":"麦克风"],["status" : model.bluetooth,"content":"蓝牙"],["status" : model.wifi,"content" : "WIFI"],["content" : "GPS","status" : model.gps],["content":"iCloud","status":model.icloud],["content":"指纹","status":finger]]
        return arr
    }
}
